import { Inject, Controller, Post, Body } from '@midwayjs/core';
import { AuthService, UserRegisterBodyRequest } from '../service/auth.service';

@Controller('/api/auth')
export class AUthController {
  @Inject()
  authService: AuthService;

  @Post('/register')
  async register(@Body() user: UserRegisterBodyRequest) {
    return await this.authService.register(user);
  }

  @Post('/login')
  async login(@Body() user: UserRegisterBodyRequest) {
    return await this.authService.login(user);
  }
}
